package cn.ac.ict.fpevaluation.fastdtw.util;

public class DistanceFunctionFactory {
   public static DistanceFunction EUCLIDEAN_DIST_FN = new EuclideanDistance();
   public static DistanceFunction MANHATTAN_DIST_FN = new ManhattanDistance();
   public static DistanceFunction BINARY_DIST_FN = new BinaryDistance();
   public static DistanceFunction COSINE_DIST_FN = new CosineDistance();
   
   public static DistanceFunction getDistFnByName(String distFnName) {
      if (distFnName.equals("EuclideanDistance")) {
         return EUCLIDEAN_DIST_FN;
      } else if (distFnName.equals("ManhattanDistance")) {
         return MANHATTAN_DIST_FN;
      } else if (distFnName.equals("BinaryDistance")) {
         return BINARY_DIST_FN;
      } else if (distFnName.equals("CosineDistance")) {
    	  return COSINE_DIST_FN;
      } else {
         throw new IllegalArgumentException("There is no DistanceFunction for the name " + distFnName);
      }
   }
}